<?php
	$title = "License";
	include("header.html");
?>

<h1>License</h1>

<h2>Overview</h2>

<p>
    The Cobertura ant tasks are licensed under the Apache Software
    License, Version 1.1. The rest of Cobertura is licensed under the
    GNU General Public License, Version 2.0. See below for detailed
    explanations.
</p>


<h2>The jcoverage License</h2>

<p>
    There are two separate version of jcoverage. One is released under
    the GPL (mostly), and the other is released under a custom, commercial
    license. You may be asking how GPL'd code could also be released
    under a more restrictive license. This is possible because the owners
    of the jcoverage copyright chose to dual-license it. From the GNU GPL
    FAQ:
</p>

<blockquote>
    <p>
        The GNU GPL does not give users permission to attach other licenses
        to the program. But the copyright holder for a program can release
        it under several different licenses in parallel. One of them may be
        the GNU GPL.
    </p>

    <p>
        The license that comes in your copy, assuming it was put in by the
        copyright holder and that you got the copy legitimately, is the
        license that applies to your copy
    </p>
</blockquote>

<p>
    Cobertura is a fork of the GPL version of jcoverage. Due to the
    copyleft nature of the GPL, Cobertura is required to use the same
    license as jcoverage.
</p>


<h2>The Apache Software License, Version 1.1</h2>

<p>
    The use of the Apache Software License in Cobertura is very straight
    forward. Cobertura includes a set of ant tasks which can be used
    to call Cobertura. Ant itself is licensed under the Apache Software
    License, Version 2.0. Because ant tasks are loaded directly into
    the runtime of ant, and the GPL is incompatable with all versions of
    the Apache Software License, ant tasks can not be licensed under the
    GPL.
</p>

<p>
    For this reason, the Cobertura ant tasks are licensed under the Apache
    Software License, Version 1.1. And because these ant tasks are not
    GPL-compatable, but the rest of Cobertura is GPL, when these ant
    tasks invoke Cobertura they must do so by exec'ing a new JVM.
</p>


<h2>The GNU General Public License, Version 2.0</h2>

<p>
    The rest of Cobertura is licensed under the GPL.
</p>


<h2>Instrumented Java Bytecode</h2>

<p>
    Here's the tricky part. Cobertura modifies your Java bytecode
    slightly. Below we discuss any possible license implications
    of these modifications
</p>

<p>
    First off, let me paste an excerpt from GNU's GPL FAQ. It's just
    something to keep in mind for this section.
</p>

<blockquote>
    <div class="faq">
        <div class="question">
            <p>
                Does the GPL require that source code of modified versions be
                posted to the public?
            </p>
        </div>

        <div class="answer">
            <p>
                The GPL does not require you to release your modified version.
                You are free to make modifications and use them privately, without
                ever releasing them. This applies to organizations (including
                companies), too; an organization can make a modified version and use
                it internally without ever releasing it outside the organization.
            </p>
        </div>
    </div>
</blockquote>

<p>
    For each line of your source code, Cobertura inserts three statements
    into the bytecode of your program. It does this using a library
    called ASM. This is called
    "instrumentation," and is done in the method
    visitLineNumber() in the class
    net.sourceforge.cobertura.coverage.MethodInstrumenter.
    It inserts Java bytecode that does the following:
</p>

<ol>
    <li>Gets an instance of coverage data</li>
    <li>Finds the coverage data for this class</li>
    <li>Increments a hit counter for this line of code</li>
</ol>

<p>
    What is the license of this generated code? Good question.
    Here's another excerpt from the GNU GPL FAQ:
</p>

<blockquote>
    <div class="faq">
        <div class="question">
            <p>
                Is there some way that I can GPL the output people get from use of
                my program? For example, if my program is used to develop hardware
                designs, can I require that these designs must be free?
            </p>
        </div>

        <div class="answer">
            <p>
                In general this is legally impossible; copyright law does not give
                you any say in the use of the output people make from their data
                using your program. If the user uses your program to enter or convert
                his own data, the copyright on the output belongs to him, not you.
                More generally, when a program translates its input into some other
                form, the copyright status of the output inherits that of the input
                it was generated from.
            </p>

            <p>
                So the only way you have a say in the use of the output is if
                substantial parts of the output are copied (more or less) from text
                in your program. For instance, part of the output of Bison (see above)
                would be covered by the GNU GPL, if we had not made an exception in
                this specific case.
            </p>

            <p>
                You could artificially make a program copy certain text into its
                output even if there is no technical reason to do so. But if that
                copied text serves no practical purpose, the user could simply delete
                that text from the output and use only the rest. Then he would not
                have to obey the conditions on redistribution of the copied text.
            </p>
        </div>
    </div>

    <p/>

    <div class="faq">
        <div class="question">
            <p>
                In what cases is the output of a GPL program covered by the GPL too?
            </p>
        </div>

        <div class="answer">
            <p>
                Only when the program copies part of itself into the output.
            </p>
        </div>
    </div>
</blockquote>

<p>
    What can we conclude from this? That it all depends on how you
    interpret the license, and that it would probably take a court's
    decision to really know where you stand. My personal opinion is that
    the license of the three statements inserted into your bytecode is
    determined by you, and by default the three statements inherit the
    license of your program.
</p>


<h2>References</h2>
<ul>
    <li><a href="">jcoverage license</a></li>
    <li><a href="http://www.apache.org/licenses/LICENSE-1.1">The Apache Software License, Version 1.1</a></li>
    <li><a href="http://www.apache.org/licenses/LICENSE-2.0">The Apache Software License, Version 2.0</a></li>
    <li><a href="http://www.gnu.org/copyleft/gpl.html">GNU General Public License</a></li>
    <li><a href="http://www.gnu.org/licenses/gpl-faq.html">Frequently Asked Questions about the GNU GPL</a></li>
    <li><a href="http://asm.objectweb.org/">ASM</a></li>
</ul>


<?php include("footer.html"); ?>
